/*
 * @(#)BasicButtonUI.java	1.119 09/08/10
 *
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
 
package player.ui;

import sun.swing.SwingUtilities2;
import sun.awt.AppContext;

import java.awt.*;
import java.awt.event.*;
import java.io.Serializable;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.plaf.ButtonUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.basic.BasicButtonUI;
import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;

/**
 * BasicButton implementation
 *
 * @version 1.119 08/10/09
 * @author Jeff Dinkins
 */
public class MyBasicButtonUI extends BasicButtonUI{
	
	public MyBasicButtonUI(){
		super();
	}
	   protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) {
	        AbstractButton b = (AbstractButton) c;                       
	        ButtonModel model = b.getModel();
	        FontMetrics fm = SwingUtilities2.getFontMetrics(c, g);
	        int mnemonicIndex = b.getDisplayedMnemonicIndex();

		/* Draw the Text */
		if(model.isEnabled()) {
		    /*** paint the text normally */
//		    SwingUtilities2.drawStringUnderlineCharAt(c, g,text, mnemonicIndex,
//						  textRect.x + getTextShiftOffset(),
//						  textRect.y + fm.getAscent() + getTextShiftOffset());

		    g.setColor(c.getBackground());
		    g.drawString(text, textRect.x + getTextShiftOffset(), textRect.y + fm.getAscent() + getTextShiftOffset()-1);
		    g.drawString(text, textRect.x + getTextShiftOffset()+1, textRect.y + fm.getAscent() + getTextShiftOffset());
		    g.drawString(text, textRect.x + getTextShiftOffset(), textRect.y + fm.getAscent() + getTextShiftOffset()+1);
		    g.drawString(text, textRect.x + getTextShiftOffset()-1, textRect.y + fm.getAscent() + getTextShiftOffset());

		    g.setColor(c.getForeground());
		  //  g.drawString(text, textRect.x + getTextShiftOffset()+1, textRect.y + fm.getAscent() + getTextShiftOffset()+1);
			
		    g.drawString(text, textRect.x + getTextShiftOffset(), textRect.y + fm.getAscent() + getTextShiftOffset());
		}
		else {
		    /*** paint the text disabled ***/
		    g.setColor(b.getBackground().brighter());
		    SwingUtilities2.drawStringUnderlineCharAt(c, g,text, mnemonicIndex,
						  textRect.x, textRect.y + fm.getAscent());
		    g.setColor(b.getBackground().darker());
		    SwingUtilities2.drawStringUnderlineCharAt(c, g,text, mnemonicIndex,
						  textRect.x - 1, textRect.y + fm.getAscent() - 1);
		}
	    }
}
